<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>admin</title>
<link href="<?php echo ADMIN_THEME?>images/reset.css" rel="stylesheet" type="text/css" />
<link href="<?php echo ADMIN_THEME?>images/system.css" rel="stylesheet" type="text/css" />
<link href="<?php echo ADMIN_THEME?>images/main.css" rel="stylesheet" type="text/css" />
<link href="<?php echo ADMIN_THEME?>images/table_form.css" rel="stylesheet" type="text/css" />
<link href="<?php echo ADMIN_THEME?>images/dialog.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<?php echo ADMIN_THEME?>js/jquery.min.js"></script>
</head>
<body>
<div class="subnav">
  <div class="content-menu ib-a blue line-x">
	<?php
	$a = isset($_GET['a']) && $_GET['a'] ? $_GET['a'] : 'index';
	foreach ($menu as $i=>$t) {
		$class = $a == $t[0] ? ' class="on"' : '';
		$span  = $i >= count($menu)-1  ? '' : '<span>|</span>';
		echo '<a href="' . purl('admin/' . $t[0]) . '" ' . $class . '><em>' . $t[1] . '</em></a>' . $span;
	}
	?>
	<span>|</span><a href="<?php echo purl('index/list');?>" target="_blank"><em>前台浏览</em></a>
  </div>
</div>
<div class="pad-lr-10">
<div class="table-list">
<form action="" method="post">
<table width="100%">
	<thead>
	<tr>
		<th width="100" align="left">类目id</th>
		<th width="200" align="left">商品类目</th>
		<th width="" align="left">子类目id</th>
	</tr>
    </thead>
    <tbody>
    <?php 
	if ($data) {
	foreach ($data as $t) { ?>
	<tr>
	  <td align="left"><?php echo $t['cid'];?></td>
	  <td align="left"><?php echo $t['name'];?></td>
	  <td align="left">
	  <?php
	  if ($t['list']) {
	  ?>
	    <select onchange='setcat(this.value, <?php echo $t['cid']?>)'>
		<option value=0>获取类目id</option>
		<?php
			foreach ($t['list'] as $c) {
				echo "<option value=".$c['cid'].">".$c['name']."</option>";
			}
			echo "</select>";
	    ?>
	  <span id='data_<?php echo $t['cid']?>'></span>
	  <?php } ?>
	  </td>
	  </tr>
      <?php } } ?>
	<tr height="25">
	  <td colspan="9" align="left">
      <input type="submit" class="button" value=" 获取类目 " name="submit">
      </td>
	  </tr>
	<tr>
	  <td>      
	  </tbody>
</table>

</form>
</div>
</div>
</div>
<script>
function setcat(id, cid) {
    $('#data_'+cid).html(id);
}
</script>
</body>
</html>
